package dp.mobile.sbm;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class HomeActivity extends TabActivity {
	public static final String TAG = "Home Act";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		//Set family
		mFamily = TabActivity.HOME_FAMILY;
		
		//Load layout
		setContentView(R.layout.home);
		
		//Set click listeners
		setTabListener();
		findViewById(R.id.home_tab1).setEnabled(false);
		int[] Clicked = new int[] { R.id.home_button1, R.id.home_button2, R.id.home_button3, R.id.home_button4 };
		for (int i = 0; i < Clicked.length; i++) findViewById(Clicked[i]).setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		//Super
		super.onClick(v);
		
		//Create intent
		Intent NewIntent = null;
		
		//Based on view id
		switch (v.getId()) {
		case R.id.home_button1:
			NewIntent = new Intent(this, NewsActivity.class);
			break;
		case R.id.home_button2:
			NewIntent = new Intent(this, HotEventAct.class);
			break;
		case R.id.home_button3:
			NewIntent = new Intent(this, JobVacancyAct.class);
			break;
		case R.id.home_button4:
			NewIntent = new Intent(this, BusinessOpportunityAct.class);
			break;
		}
		
		//If intent exist
		if (NewIntent != null) startActivity(NewIntent);
	}	
}
